<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\api\model\Banner;
use app\admin\model\general\Messages;
use app\admin\model\goods\Goods;
use fast\Http;

/**
 * 电池查询
 */
class Cell extends Api
{

    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['index'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    /**
     * 开始查询
     *
     * @ApiMethod (POST)
     */
    public function set()
    {
        $user = $this->auth->id;
        $token = 1;
        $vin = input('vin');
        $trandNo = 2;
        $url = "https://wz.bajiechewu.com/?a=newEnergyVehicles&c=create";

        $header         =       [
                                    CURLOPT_HTTPHEADER  => [
                                                "Content-Type:application/x-www-form-urlencoded",
                                    ]
                            ];

        // mylog(['request' => ['image' => $image, 'user' => $this->auth->mobile]], 'license');
        $data = [
                    'user' => $user,
                    'token' => $token,
                    'vin' => $vin,
                    'trandNo' => $trandNo,
                ];
        $result = Http::post($url, $data, $header);
        dump($result);
        $result = json_decode($result);
        dump($result);
        $this->success('OK',$result);
    }
}
